package com.example.dps;

import android.graphics.Color;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceActivity;
import android.view.Menu;
import android.view.MenuItem;

public class SettingsNotificationsActivity extends PreferenceActivity{
	
	
	@Override
    public void onCreate(Bundle savedInstanceState) {        
        super.onCreate(savedInstanceState);      
        //setTheme(R.style.CustomTheme);
        addPreferencesFromResource(R.xml.notification_preferences);      
        setTheme(R.style.PrefsTheme);
        this.getListView().setBackgroundDrawable(Utility.returnAdjustedBackgroundDrawable(this));
        
        
        CheckBoxPreference enableSound = (CheckBoxPreference) this.getPreferenceScreen().findPreference("enableSoundPref");
        
        enableSound.setOnPreferenceClickListener(new OnPreferenceClickListener(){

			@Override
			public boolean onPreferenceClick(Preference pref) {
				
				// TODO Auto-generated method stub
				
				CheckBoxPreference check = (CheckBoxPreference) pref;
				
				if(check.isChecked()) check.setSummary("enabled");
				else if(check.isChecked() == false) check.setSummary("disabled");

				return false;
			}
        	
        });
        
        CheckBoxPreference enableVibrate = (CheckBoxPreference) this.getPreferenceScreen().findPreference("enableVibratePref");
        
        enableVibrate.setOnPreferenceClickListener(new OnPreferenceClickListener(){

			@Override
			public boolean onPreferenceClick(Preference pref) {
				
				// TODO Auto-generated method stub
				
				CheckBoxPreference check = (CheckBoxPreference) pref;
				
				if(check.isChecked()) check.setSummary("enabled");
				else if(check.isChecked() == false) check.setSummary("disabled");

				return false;
			}
        	
        });
        
    }
    
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        menu.add(Menu.NONE, 0, 0, "Show current settings");
        return super.onCreateOptionsMenu(menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case 0:
                //startActivity(new Intent(this, ShowSettingsActivity.class));
                return true;
        }
        return false;
    }
	

}
